package com.jianyun.jyzs.bean;

import java.util.List;

import cn.rongcloud.rce.lib.CacheTask;

/**
 * Created by mlli on 2017/11/24.
 * 用了判断工单类型吧
 */

public class WOTools {

    public static int getType(String createId,String responseId){
        int id = 3;
        String userId = CacheTask.getInstance().getUserId();
        if (userId.equals(createId))id = 1;
        if (userId.equals(responseId))id = 2;
        return id;
    }

    public static int getType(WorkOrderDetialResponse.WorkOrder po){
        String userId = CacheTask.getInstance().getUserId();
        String createUserId = po.getCreateUserId();
        String responUserId = po.getResponUserId();
        if (userId.equals(createUserId))return 1;
        if (userId.equals(responUserId))return 2;
        return 3;
    }

    public static int getType(QualityRespon.QualityRes po){
        String userId = CacheTask.getInstance().getUserId();
        String createUserId = po.getCreateUserId();
        String responUserId = po.getResponUserId();
        if (userId.equals(createUserId))return 1;
        if (userId.equals(responUserId))return 2;
        return 3;
    }

    public static int getType(SafeInsResponse.SafeBean po){
        String userId = CacheTask.getInstance().getUserId();
        String createUserId = po.getCreateUserId();
        String responUserId = po.getResponUserId();
        if (userId.equals(createUserId))return 1;
        if (userId.equals(responUserId))return 2;
        return 3;
    }

    public static boolean setWOTitlePoint(List<WorkOrderDetialResponse.WorkOrder> orders) {
        for (WorkOrderDetialResponse.WorkOrder ww:orders
             ) {
            if (ww.isUnRead()){
                return true;
            }
        }
        return false;
    }

    public static boolean setQualityTitlePoint(List<QualityRespon.QualityRes> orders) {
        for (QualityRespon.QualityRes ww:orders
                ) {
            if (ww.isUnRead()){
                return true;
            }
        }
        return false;
    }

    public static boolean setSecurityTitlePoint(List<SafeInsResponse.SafeBean> orders) {
        for (SafeInsResponse.SafeBean ww:orders
                ) {
            if (ww.isUnRead()){
                return true;
            }
        }
        return false;
    }
}
